<!DOCTYPE html>
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

</head>
<body>
<div id="app">
    <div>{{message}}</div>
</div>


<script src="../js/vue.js"></script>
<script src="../js/axios.js"></script>
<script>
    const vm = new Vue({
        el: "#app",
        data: {
            message: "Nihao"
        },
        methods: {},
        created: function () {
            //// 发送 POST 请求
            axios({
                method: 'post',
                url: 'http://localhost:8972/test',
                data: {
                    name: '李四',
                    id: '23',
                    date: new Date()
                }
            }).then(res => {
                console.log(res)
            });
        },
        mounted: function () {
            // 获取远端图片
            axios({
                method: 'get',
                url: '../123.jpg',
                responseType: 'stream'
            })
                .then(function (response) {
                    response.data.pipe(fs.createWriteStream('123.jpg'))
                });
        }
    })


</script>
</body>
</html>